<?php

class Horario{
	public $IdHorario;
	public $PaperSession ;
	public $Hora ;	
	public $dia;

	
	function __construct($row){
		$this->IdHorario = $row['IdHorario'];
		$this->PaperSession = $row['PaperSession'];
		$this->Hora = $row['Hora'];
		$this->dia = $row['dia'];
	}
	
	static function Listar(){
		global $dbh;
		
		$sql = 'SELECT IdHorario,PaperSession,Hora,dia  FROM Horario order by orden';
		$lista = array();
		 
		foreach($dbh->query($sql) as $row) {
			$lista[] = new Horario($row);
		}
		
		return $lista;
	}
	
	static function Obtener($id){
		global $dbh;
		
		$sql = 'SELECT IdHorario,PaperSession,Hora,dia  FROM `Sala` WHERE `IdHorario` = '.$id;
		
		$tp = NULL;
		foreach($dbh->query($sql) as $row){
			$tp = new Horario($row);	
		}		
		return $tp;			
	}
	
	
}
?>